import {baseUrl} from "@/config/env";
import startSearchModel from "@/config/startSearchModel";
import userApi from "@/api/sys/userApi";
import userOption from "@/option/sys/userOption";
import optionUtils from "@/option/optionUtils";

const taskCandidateOption = {
    size: 'small',
    labelWidth: 120,
    menuWidth: 200,
    index: true,
    page: true,
    align: "center",
    menuAlign: 'center',
    menuPosition: "right",
    labelPosition: "top",
    searchBtn: true,
    searchShow: false,
    emptyBtn: false,
    submitBtn: false,
    header: true,
    editBtn: false,
    delBtn: true,
    addBtn: true,
    boxType: 'add',
    permissionBtn: {
        addBtn: 'start:act:task:candidate_user:add',
        delBtn: 'start:act:task:candidate_user:del',
    },
    column: [
        {
            label: '用户名',
            span: 24,
            prop: 'userId',
            type: "table",
            props: {
                label: 'userFinalName',
                value: 'id'
            },
            hide: true,
            addDisplay: true,
            children: userOption(),
            onLoad: (onLoadParams, callback) => {
                onLoadParams.pageDefinition = userApi.list
                onLoadParams.valueDefinition = userApi.getUserInfo
                onLoadParams.option = userOption();
                optionUtils.tableOnLoad(onLoadParams, callback)
            },

        },
        {
            label: '用户类型',
            span: 24,
            prop: 'startUserType',
            showColumn: true,
            display: false,
        },
        {
            label: '头像',
            row: true,
            accept: "image/*",
            prop: 'avatar',
            type: "upload",
            limit: 1,
            listType: 'picture-card',
            showColumn: false,
            display: false,
            span: 24,
            action: `${baseUrl}/start/resource/formUpload`,
            propsHttp: {
                name: 'ossName',
                res: 'data',
                url: 'ossUrl',
            },
            rules: [{
                required: false,
                trigger: "blur"
            }]
        },
        {
            label: '姓名',
            span: 24,
            prop: 'realName',
            showColumn: true,
            display: false,
            rules: [{
                required: true,
                message: "请输入姓名",
                trigger: "blur"
            }]
        },

        {
            label: '电话',
            span: 24,
            prop: 'phone',
            search: false,
            display: false,
        },
        {
            label: '邮箱',
            span: 24,
            prop: 'email',
            search: false,
            type: "input",
            display: false,
        },
    ]
}
export default taskCandidateOption
